home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / rmtc01.zip / WRITEDEF.C < prev   
Text File  |  1991-11-02  |  1KB  |  47 lines

  1. /* ************************************************ */
  2. /*                     WriteDef.c                   */
  3. /* Purpose : Creates a DEF file                     */
  4. /* Compiler: Turbo C V2.0                           */
  5. /* Date    : Oct 31, 1991                           */
  6. /* ************************************************ */
  7.  
  8. #include <graphics.h>
  9. #include <stdio.h>
  10. #include <alloc.h>
  11.  
  12. main()
  13. {
  14.  
  15.   FILE *F;
  16.   int driver, mode, size;
  17.   int x, y, x2, y2, i, j;
  18.   int Col;
  19.   driver=EGA;
  20.   mode=EGAHI;
  21.   initgraph(&driver, &mode, "");        /* Set path to your EGAVGA.BGI   */
  22.   setcolor(WHITE);
  23.   rectangle(300,120,349,169);
  24.   setfillstyle(SOLID_FILL,LIGHTBLUE);
  25.   bar(301,121,348,168);
  26.   setfillstyle(SOLID_FILL,YELLOW);
  27.   bar(311,122,321,141);
  28.   setfillstyle(SOLID_FILL,LIGHTGREEN);
  29.   bar(331,151,346,166);
  30.   x=300;
  31.   y=120;
  32.   x2=349;
  33.   y2=169;
  34.   F=fopen("sample.def","w");            /* Sample.def will be in the    */
  35.   for (j=y;j<y2+1;j++)                  /* current directory.           */
  36.   {
  37.     for (i=x;i<x2+1;i++)
  38.     {
  39.       Col=getpixel(i,j);
  40.       fprintf(F,"%X",Col);
  41.     }
  42.     fprintf(F,"\n");
  43.   }
  44.   fclose(F);
  45.   getch();
  46.   closegraph();
  47. }